<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <script type="text/javascript" src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/compressorjs/1.1.1/compressor.min.js"></script><script type="text/javascript" src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/vue/2.6.14/vue.min.js"></script><script type="text/javascript" src="https://unpkg.com/vue-preview@1.1.3/dist/vue-preview.min.js"></script>
    <title>069-浏览器图片压缩</title>
    <style>
      img {
        max-width: 300px;
      }
    </style>
    <script type="module" crossorigin src="../../../../static/js/069-index.html-5ad0e542.js"></script>
    <link rel="modulepreload" crossorigin href="../../../../static/common/modulepreload-polyfill-3cfb730f.js">
  </head>

  <body>
    <div id="app" class="box">
      <p>
        本案例使用 compressorjs 进行图片压缩 详细参考官方文档
        <a href="https://fengyuanchen.github.io/compressorjs/" target="_blank">compressorjs</a>
      </p>
      <div>
        文件：
        <input type="file" @change="selectFile" accept=".jpg, .png, .webp" />
        压缩级别：
        <input type="number" min="1" max="9" v-model="quality" placeholder="压缩级别" />
      </div>

      <p>压缩前大小: {{ size }}</p>
      <p>压缩后大小: {{ sizeMin }}</p>
      <hr />
      <p>使用场景：图片预览</p>
      <vue-preview :slides="slides"></vue-preview>
    </div>
    
  </body>
</html>
